
$.ZDNUM_map1 = function(el,data){
  var d = data || [
    {value: 60, name: '正常', itemStyle: {color: '#5DFC9D'}},
    {value: 32, name: '异常', itemStyle: {color: '#FFBC47'}},
    {value: 28, name: '停机', itemStyle: {color: '#FCF75D'}}
  ];
  var op = {
    data:d
  }
  baseMap1(el,op)
}

$.ZDNUM_map2 = function(el,data){
  var d = data || {
    name:["查询类","预约类","申办类"],
    value:[55, 35, 30]
  };
  var op = {
    data:d
  }
  baseMap2(el,op)
}

//热门终端TOP5
$.RMZDSBTOP5_map = function(el,data){
  var d = data || {
    name: ['终端1', '终端2', '终端3', '终端4', '终端5'],
    value: [320, 200, 150, 80, 70]
  };
  var op = {
    name:"单位：笔",
    color:'#5DFC9D',
    data:d
  }
  baseMap3(el,op)
}


//热门业务事项TOP5
$.RMYWSXTOP5_map = function(el,data){
  var d = data || {
    name: ['事项1', '事项2', '事项3', '事项4', '事项5'],
    value: [320, 200, 150, 80, 70]
  };
  var op = {
    name:"单位：笔",
    color:'#FFBC47',
    data:d
  }
  baseMap3(el,op)
}


//总业务量
$.YWZL_map = function(el,data){
  var d = data || {
    name: ['事项1', '事项2', '事项3', '事项4', '事项5'],
    value: [320, 200, 150, 80, 70]
  };
  var op = {
    name:"",
    color:['#FCF75D','#FF7723','#5DFC9D','#8E30FF','#0263FF'],
    data:d
  }
  baseMap3(el,op)
}


//1.饼图渲染设置
function baseMap1(el,op){
  var rich = {
    yellow: {
      color: "#ffc72b",
      fontSize: 14*KO,
      padding: [0, 2],
      align: 'center',
      fontWeight:'bold'
    },
    blue: {
      color: '#49dff0',
      fontSize: 14*KO,
      align: 'center'
    },
    hr: {
      borderColor: 'auto',
      width: '100%',
      borderWidth: 1,
      height: 0,
    }
  };
  var option = {
    grid: {
      top: '-10%',

    },
    series: [{
      type: 'pie',
      radius: '40%',
      center: ['50%', '60%'],
      center: ["50%", "50%"], 　　　　//这个属性调整图像的位置
      data: op.data,
      label: {
        normal: {
          fontSize: 14*KO,
          color: "#fff",
          formatter: '{b}{yellow|{c}}',
          // formatter: '{b}{yellow|{c}}台\n{blue|{d}%}',
          // formatter: '{b}{yellow|{c}}台\n{blue|{d}%}{hr|}',
          // formatter: function(params, ticket, callback) {
          //   return '{b}{yellow|'+params*2+'}台\n{blue|{d}%}';
          // },
          // padding: [10*KO, -50*KO,0],
          rich: rich
        }
      },
      labelLine: {
        show: true,  //不显示折线
        lineStyle: {
          width: 2*KO
        },
        length1: 0, //线条长度
        length2: 0  //线条长度
      }
    }]
  };
  echarts.init(el).setOption(option);
}

//2.横向柱状图渲染设置
function baseMap2(el,op){
  var option = {
    // tooltip: {
    //     trigger: 'axis',
    //     axisPointer: {
    //         type: 'shadow'
    //     }
    // },
    grid: {
      top:'10%',
      bottom:'15%',
      right:'15%',
      left: 85*KO
    },
    xAxis: {
      type: 'value',
      axisLabel: {      
        show:false     //不显示水平标识
      },
      axisLine: {       
        show:false,    //不显示水平轴线
      },
      splitLine: { 
        show: false    //不显示网格线
      }
    },
    yAxis: {
        type: 'category',
        inverse: true,
        data: op.data.name,
        axisLabel: {
          // interval:0,       //强制显示所有刻度标签
          margin: 20*KO,
          color: '#fff',
          textStyle: {
              fontSize: 14*KO
          }
        },
    },
    series: [{
      type: 'bar',
      barWidth: 30*KO,
      data: op.data.value,
      label: {
        normal: {
          show: true,
          // show: true,
          // textBorderColor: '#333',
          // textBorderWidth: 2
          // lineHeight: 20*KO,
          // width: 80,
          // height: 30*KO,
          // backgroundColor: 'red',
          // position: ['102%', KO*8],
          position: 'right',
          distance: 1,
          formatter: '{a|{c}}',
          rich: {
            a: {
              color: '#FF8226',
              align: 'center',
              fontWeight:'bold',
              fontSize: 14*KO
            }
          }
        }
      },
      itemStyle: {
        normal: {
          color: '#FCF75D',
          // borderWidth: 5*KO,
          // borderColor: "#65FFFF"
        }
      },

    }]
  };
  echarts.init(el).setOption(option);
}

//3.竖向柱状图渲染设置
function baseMap3(el,op){
  var option = {
    grid: {
      top:'15%',
      bottom:'20%',
      left:'15%'
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross',
        label:{
          show:true,
          backgroundColor: '#FFED27',
          fontSize: 14*KO,
          color:'#001A53'                  
        }
      },
      textStyle:{
        fontSize: 14*KO
      },
      formatter:'{b}：<span style="color:#FFED27;">{c}</span>',
      // padding:[5*KO,10*KO]
    },
    xAxis: {
      type: 'category',
      data: op.data.name,
      axisLabel: {
        interval:0,      //强制显示所有刻度标签
        rotate:-30,       //标签旋转30度
        margin: 10*KO,
        color: '#e2e9ff',
        textStyle: {
            fontSize: 14*KO
        }
      },
      axisLine: {               //设置轴线
        lineStyle:{
            type:'dashed',      //设置网格线类型 dotted：虚线   solid:实线
            color: ['#fff'],
            width: 1
        },
      },
      splitLine: {         //设置网格线样式
        show:true,         //隐藏或显示
        lineStyle:{
          type:'dashed',  //设置网格线类型 dotted：虚线   solid:实线
          color: ['#315070'],
          width: 1
        }
  　　}
    },
    yAxis: {
      name: op.name,
      nameGap: 15*KO,    //坐标名称与轴线的距离
      nameTextStyle: {    //坐标轴名称样式
        color: "#fff",
        fontSize: 16*KO,
        fontWeight:'bold',
        backgroundColor: "" //文字块背景色
      },
      type: 'value',
      axisLabel: {
        interval:0,      //强制显示所有刻度标签
        margin: 10*KO,
        color: '#e2e9ff',
        textStyle: {
            fontSize: 14*KO
        }
      },
      axisLine: {               //设置轴线
        lineStyle:{
          type:'dashed',      //设置网格线类型 dotted：虚线   solid:实线
          color: ['#fff'],
          width: 1
        }
      },
      splitLine: {         //设置网格线样式
        show:true,         //隐藏或显示
        lineStyle:{
            type:'dashed',  //设置网格线类型 dotted：虚线   solid:实线
            color: ['#315070'],
            width: 1
        },
  　　}
    },
    series: [{
      data: op.data.value,
      type: 'bar',
      barWidth: 30*KO,
      itemStyle: {
        color: function (params){
          var colorList = op.color;
          if(colorList instanceof Array){
            return colorList[params.dataIndex]
          }else{
            return op.color
          }
        }
        // color: op.color
      },
      label: {
        normal: {
          show: true,
          // lineHeight: 20*KO,
          // width: 80*KO,
          // height: 30*KO,
          // backgroundColor: 'red',
          // borderRadius: 200,
          // position: [0, -15*KO],
          position: 'top',
          formatter: [
            ' {a|{c}}',
          ].join(','),
          rich: {
            a: {
              color: 'yellow',
              align: 'center',
              fontSize: 14*KO
            }
          }
        }
      }
    }]
  };
  // 基于准备好的dom，初始化echarts实例
  // var md = echarts.init(el);
  // md.setOption(option);
  echarts.init(el).setOption(option);
}
